package com.diandi.messages.enums;

/**
 * Created by Administrator on 2017/6/29.
 */
public enum ReturnCode {

    ok("OK","成功"),
    SUCCESS("SUCCESS","消息发送成功"),
    err("ERR","失败"),
    err_1000("ERR_LACK_PARAM","缺少必备参数"),
    err_1001("ERR_NULL_PARAM","参数不能为空"),
    err_1002("ERR_TYPE_PARAM","参数类型错误"),
    err_1003("ERR_ILLEGAL_PARAM","参数值非法"),
    err_1004("ERR_MERCHANT_PARAM","商户号必填"),
    err_1005("ERR_NULL_ALL_PARAMS","未接收到接口参数"),
    err_1006("ERR_NULL_ALL_PARAMS","未接收到接口参数"),
    err_1007("ERR_NULL_ALL_PARAMS","未接收到接口参数"),
    err_1008("ERR_NULL_ALL_PARAMS","未接收到接口参数"),
    err_2000("ERR_REPEAT_ORDER","订单号重复"),
    err_8001("ERR_ERROR","处理失败"),
    err_8002("ERR_ERROR","短信通道未开通"),
    err_2999("ERR_NOT_ORDER","不存在此订单号"),
    err_9000("ERR_HANDLE_ORDER","订单处理异常"),
    err_9001("ERR_FAIL_SIGN","签名认证失败"),
    err_9002("ERR_FAIL_PARAM","参数校验失败"),
    err_9003("ERR_QUERY_TRADE","查询不到此交易流水号相关信息"),

    ;

    ReturnCode(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    private String code;
    private String msg;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static ReturnCode getEmun(String code){
        for (ReturnCode returnCode : ReturnCode.values()) {
            if(returnCode.getCode().equals(code)){
                return returnCode;
            }
        }
        return null;
    }
}
